package com.xxjqr.rbac.mapper;

import com.xxjqr.rbac.entity.pojo.TbRoleMenuRel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 丁昌江
 * @since 2021-02-08
 */
public interface TbRoleMenuRelMapper extends BaseMapper<TbRoleMenuRel> {

    //@Select("select menu_id from tb_role_menu_rel where is_delete = 0 and role_id  = #{id} and node_type != 1 and id not in (select parent_id from tb_role_men_rel)")
    @Select("select menu_id from tb_role_menu_rel " +
            "where is_delete = 0 and role_id  = #{roleId} " +
            "and menu_id not in (select parent_id from tb_menu where is_delete = 0 and status = 1)")
    List<Long> getRoleMenuIds(Long id);


    List<Map<String,Object>> getUrlRoleMap();

//    @Select("select id,menu_id,menu_id,is_delete from tb_role_menu_rel where role_id = #{roleId}")
//    List<TbRoleMenuRel> getByRole(Long roleId);
}
